'''
    assert r.json()['code'] == repeat_data['expect']['code']
    assert r.json()['msg'] == repeat_data['expect']['msg']
    assert r.json()['status'] == repeat_data['expect']['status']
Check.equal(r.json(),repeat_data['expect'],"code,msg,status")

'''
import pytest_check as c

def equal(real,expect,keys):
    '''

    :param real: 字典
    :param expect: 字典
    :param keys: keys用逗号分割
    :return: key对应的value是否相同
    '''
    ks = keys.split(",")
    for k in ks:
        r = real.get(k)#根据key取value
        e = expect.get(k)
        # try:
        b = c.equal(r,e)#pytest_check中的equal方法来对比
        if b == False:
            print(f"检查项：{k}效验失败，预期结果：{e}，实际结果:{r}")
        # except Exception as e:
        #     print(f"检查项：{k}效验失败，预期结果：{e}，实际结果:{r}")

